package com.example.myapplication.KeChengJiPinBanJiAdapter;

import android.app.Activity;
import android.graphics.Paint;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.example.myapplication.KeChengJinPinBanJiBean.KeChengJiBanBanJiBean;
import com.example.myapplication.R;

import java.util.ArrayList;
import java.util.List;

public class KeChengJingPinBanJiAdapter extends BaseAdapter {
    List<KeChengJiBanBanJiBean>list=new ArrayList<>();
    Activity activity;

    public KeChengJingPinBanJiAdapter(List<KeChengJiBanBanJiBean> list, Activity activity) {
        this.list = list;
        this.activity = activity;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int i) {
        return list.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        view= LayoutInflater.from(activity).inflate(R.layout.kecheng_fragment_jingpinbanji_mokuai,null);
        TextView banji=view.findViewById(R.id.KeCheng_MoKuai_JingPinBanJi_banji);
        TextView zhuangtai=view.findViewById(R.id.KeCheng_MoKuai_JingPinBanJi_zhuangtai);
        TextView tap1=view.findViewById(R.id.KeCheng_MoKuai_JingPinBanJi_tap1);
        TextView tap2=view.findViewById(R.id.KeCheng_MoKuai_JingPinBanJi_tap2);
        TextView date=view.findViewById(R.id.KeCheng_MoKuai_JingPinBanJi_date);
        TextView qian1=view.findViewById(R.id.KeCheng_MoKuai_JingPinBanJi_qian1);
        TextView qian2=view.findViewById(R.id.KeCheng_MoKuai_JingPinBanJi_qian2);
        TextView minge=view.findViewById(R.id.KeCheng_MoKuai_JingPinBanJi_minge);
        TextView baoming=view.findViewById(R.id.KeCheng_MoKuai_JingPinBanJi_baoming);
        banji.setText(list.get(i).getBanji());
        zhuangtai.setText(list.get(i).getZhuangtai());
        tap1.setText(list.get(i).getTap1());
        tap2.setText(list.get(i).getTap2());
        date.setText(list.get(i).getDate());
        qian1.setText(list.get(i).getQian1());
        qian2.setText(list.get(i).getQian2());
        minge.setText(list.get(i).getMinge());
        baoming.setText(list.get(i).getBaoming());
        //设置中划线
        qian1.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);
//        textview.getPaint().setFlags(Paint. STRIKE_THRU_TEXT_FLAG); //中划线
//        setFlags(Paint. STRIKE_THRU_TEXT_FLAG|Paint.ANTI_ALIAS_FLAG); // 设置中划线并加清晰

        return view;
    }
}
